package LeetCode.Simple;

/*
把一个有序数组的最开始的若干个元素搬到数组的末尾，之后找到数组的最小值
 */
public class Question006 {
    public int minArray(int[] numbers){
        int min = 0;
        int max = numbers.length - 1;
        while(min < max){
            int p = min + (max - min) >>> 2;
            if(numbers[p] > numbers[max]){
                min = p + 1;
            }else if(numbers[p] < numbers[max]){
                max = p;
            }else{
                max = max - 1;
            }
        }
        return numbers[min];
    }
}
